import { createRouter, createWebHistory } from 'vue-router'
import ShopLogin from '../components/ShopLogin.vue'
import ShopRegister from '../components/ShopRegister.vue'
import SecuritySetting from '../components/SecuritySetting.vue'
import NotFound from '../components/NotFound.vue'
import ShopIndex from '../components/ShopIndex.vue'

//首页子路由
import ShopSetting from '@/components/security/ShopSetting.vue'
import ReceivingAddress from '@/components/security/ReceivingAddress.vue'
import ShopAvatar from '@/components/security/ShopAvatar.vue'
import ShopPerson from '@/components/security/ShopPerson.vue'
import TransactionInformation from '@/components/security/TransactionInformation.vue'
import ShoppingCart from '@/components/ShoppingCart.vue'

const routes = [{
    path: '/',
    redirect: '', //指定界面
    name: 'ShopLogin', //路由名称
    component: ShopLogin //对应的组件
},
{
    path: '/ShopRegister',//注册界面
    name: 'ShopRegister',
    component: ShopRegister
}, {
    path: '/SecuritySetting',
    component: SecuritySetting,
    redirect: '/SecuritySetting/ShopSetting', children: [
        { path: 'ShopSetting', component: ShopSetting }, //子路由
        { path: 'ReceivingAddress', component: ReceivingAddress },
        { path: 'ShopAvatar', component: ShopAvatar },
        { path: 'ShopPerson', component: ShopPerson },
        { path: 'TransactionInformation', component: TransactionInformation }
    ]
},
{
    path: '/404',
    name: 'NotFound',
    component: NotFound
}, {
    path: '/ShopIndex',
    name: 'ShopIndex',
    component: ShopIndex
}, {
    path: '/ShoppingCart',
    name: 'ShoppingCart',
    component: ShoppingCart
}
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router